// Raf Lempens & Bjorn Schobben
#include "QtBoard.h"
#include "QtCell.h"

QtBoard::QtBoard(): tileManager(0)
{
}

QtBoard::~QtBoard()
{
}


void QtBoard::SetTileManager(QtTileManager* manager)
{
	tileManager = manager;
}

void QtBoard::Resize(unsigned int width, unsigned int height)
{
	Board::Resize(width, height);


	bounds = QRect(0, 0, width, height);

	QPainterPath path;
	path.addRect(bounds);
	shapepath = path;
}

Cell* QtBoard::CreateCell(unsigned int cellX, unsigned int cellY)
{
	QtCell* cell = new QtCell();

	cell->SetPosition(QPoint(cellX*CELLSIZE, cellY*CELLSIZE));

	if (tileManager)
	{
		cell->SetPixmap( tileManager->Tile(*cell, "background") );
	}

	AddSprite(cell);

	return cell;
}

QRectF QtBoard::boundingRect() const
{
	return bounds;
}

QPainterPath QtBoard::shape() const
{
	return shapepath;
}


void QtBoard::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
}


